<template>
  <img alt="Vue logo" style="height:1000px" src="./assets/logo.png" />
  <!-- 传统写法 -->
  <p @click="$store.commit('add')">{{$store.state.count}}</p>
  <!-- compostion写法 -->
  <p @click="add">{{count}}</p>
  <!-- <HelloWorld msg="Hello Vue 3.0 + Vite" /> -->
  <!--  <Todos></Todos> -->
  <router-view></router-view>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import Todos from './components/todos/Todos.vue'
import { useStore } from 'vuex'
import { toRefs } from 'vue'
export default {
  name: 'App',
  components: {
    HelloWorld,
    Todos
  },
  setup (props) {
    const store = useStore();
    console.log(store)
    return {
      ...toRefs(store.state),
      add () {
        store.commit('add')
      }
    }
  }
}
</script>
